package com.sc.test;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.sc.test.bean.MessageEvent;
import com.sc.test.utils.RxBus;

import org.greenrobot.eventbus.EventBus;

import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Shen Chao on 2018-01-10-010 下午 14:33.
 */

public class SecondActivity extends AppCompatActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);
        ButterKnife.bind(this);
    }

    @OnClick({R.id.btn_second_send, R.id.btn_second_sendSticky,R.id.btn_second_sendrxjava})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.btn_second_send:
                EventBus.getDefault().post(new MessageEvent("play game", "jack", 5));
                finish();
                break;
            case R.id.btn_second_sendrxjava:
                RxBus.getInstance().post(new MessageEvent("play game", "jack", 5));
                finish();
                break;
            case R.id.btn_second_sendSticky:
                EventBus.getDefault().postSticky(new MessageEvent("play game", "jack", 5));
                finish();
                break;
        }
    }
}
